import 'dart:convert';

import 'package:du_application/http/HttpUtil.dart';
import 'package:du_application/model/CategoryModel.dart';
import 'package:flutter/material.dart';

class ClassProvider with ChangeNotifier {
    CategoryModel categoryModel;
    Classify classify;
 
   getCategory() async{
   
     await  HttpUtil.getInstance().get("/catalog/getClassify").then((data) {
     categoryModel = CategoryModel.fromJson(json.decode(data.toString()));
     classify=categoryModel.data.classify[0];
    });
   notifyListeners();
  }
  selectCategory(id){
categoryModel.data.classify.forEach((item){
 if(item.id==id){
    classify=item;
    notifyListeners();
 }
}
);
  }


}